home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / EnterAct 3.5 / Drag_on Modules / hAWK programs / $Renumber_PICTs < prev    next >
Encoding:
Text File  |  1993-02-08  |  921 b   |  35 lines  |  [TEXT/KEEN]

  1. #$Renumber_PICTs: 
  2. # run on a specific derezzed resource description file containing PICT's,
  3. # to change the PICT numbers.
  4. # MODIFY the formula for "num" below to suit your current needs.
  5. # Set 'outfile' variable to the output file name (eg test.r) with Set Variables.
  6.  
  7. # to be renumbered.
  8.  
  9.  
  10. BEGIN {
  11.     z = split(ARGV[1], names, ":");#fragment the full path into the array “names”
  12.     for (i = z-1; i >= 1; --i) #note i = z gives the input file name proper
  13.         outfile = names[i] ":" outfile;#put path in front of outfile name
  14.     progressFile = STDPATH "$tempProgress"
  15.     }
  16.  
  17. /resource 'PICT' \(/    {
  18.     match($0, /[0-9]+/);
  19.     num = substr($0,RSTART, RLENGTH)
  20.     #1000->2000,1001->2100 etc
  21.     num = int(2000 + (num-1000)*100)
  22.     sub(/[0-9]+/, num)
  23.     print $0 > outfile
  24.     if (!progress(++q "done..."))
  25.         { # concurrent mode, print progress to file
  26.         print q, "done..." > progressFile
  27.         close(progressFile)
  28.         }
  29.     next
  30.     }
  31.  
  32.     { 
  33.     print $0 > outfile
  34.     }
  35.